package org.hzero.exam.infra.repository.impl;

import org.hzero.exam.domain.entity.HodrItem;
import org.hzero.exam.domain.repository.HodrItemRepository;
import org.hzero.exam.infra.mapper.HodrItemMapper;
import org.hzero.mybatis.base.impl.BaseRepositoryImpl;
import org.hzero.mybatis.domian.Condition;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author 马旭阳
 * @date2019/8/5
 */
@Repository
public class HodrItemRepositoryImpl extends BaseRepositoryImpl<HodrItem> implements HodrItemRepository {
    @Autowired
    private HodrItemMapper itemMapper;
    @Override
    public List<HodrItem> selectByItemCodeAndDescription(String itemCode, String itemDescription) {
        Condition condition = new Condition(HodrItem.class);
        condition.createCriteria().andLike("itemCode",itemCode).andLike("itemDescription",itemDescription);

        return itemMapper.selectByCondition(condition);
    }

    @Override
    public HodrItem selectByItemCode(String itemCode) {
        return itemMapper.selectByItemCode(itemCode);
    }
}
